/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.campaign.entities;

import com.aptech.campaign.component.PropertyIndex;
import java.sql.Date;

/**
 *
 * @author Tai Nguyen
 */
public class Campaign implements PropertyIndex {

    private int campaignID;
    private String campaignName;
    private int productID;
    private Date startDate;
    private Date endDate;
    private int typeID;
    private int offerID;
    private boolean status;
    private String lastError;
    /**
     *
     * @return boolean value
     */
     

    public boolean validate() {
        if (startDate.compareTo(endDate) == 0 || startDate.compareTo(endDate) > 0) {
            setLastError("StartDate invalid!");
            return false;
        }
        return true;
    }

    /**
     * @return the campaignID
     */
    public int getCampaignID() {
        return campaignID;
    }

    /**
     * @param campaignID the campaignID to set
     */
    public void setCampaignID(int campaignID) {
        this.campaignID = campaignID;
    }

    /**
     * @return the campaignName
     */
    public String getCampaignName() {
        return campaignName;
    }

    /**
     * @param campaignName the campaignName to set
     */
    public void setCampaignName(String campaignName) {
        this.campaignName = campaignName;
    }

    /**
     * @return the startDate
     */
    public Date getStartDate() {
        return startDate;
    }

    /**
     * @param startDate the startDate to set
     */
    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    /**
     * @return the endDate
     */
    public Date getEndDate() {
        return endDate;
    }

    /**
     * @param endDate the endDate to set
     */
    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    /**
     * @return the productID
     */
    public int getProductID() {
        return productID;
    }

    /**
     * @param productID the productID to set
     */
    public void setProductID(int productID) {
        this.productID = productID;
    }

    /**
     * @return the typeID
     */
    public int getTypeID() {
        return typeID;
    }

    /**
     * @param typeID the typeID to set
     */
    public void setTypeID(int typeID) {
        this.typeID = typeID;
    }

    /**
     * @return the offerID
     */
    public int getOfferID() {
        return offerID;
    }

    /**
     * @param offerID the offerID to set
     */
    public void setOfferID(int offerID) {
        this.offerID = offerID;
    }

    /**
     * @return the status
     */
    public boolean isStatus() {
        return status;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(boolean status) {
        this.status = status;
    }

    public Object getPropertyValue(int index) {
        String value = "";
        switch (index) {
            case 1:
                value = String.valueOf(this.getCampaignID());
                break;
            case 2:
                value = this.getCampaignName();
                break;
            case 3:
                value = String.valueOf(this.getProductID());
                break;
            case 4:
                value = String.valueOf(this.getStartDate());
                break;
            case 5:
                value = String.valueOf(this.getEndDate());
                break;
            case 6:
                value = String.valueOf(this.getTypeID());
                break;
            case 7:
                value = String.valueOf(this.getOfferID());
                break;
            case 8:
                value = String.valueOf(this.isStatus());
                break;

        }
        return value;
    }

    public void setPropertyValue(int index, Object value) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public Class getPropertyClass(int index) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    /**
     * @return the lastError
     */
    public String getLastError() {
        return lastError;
    }

    /**
     * @param lastError the lastError to set
     */
    public void setLastError(String lastError) {
        this.lastError = lastError;
    }
}
